package cn.kgc.tangcco.service;

import cn.kgc.tangcco.pojo.Idiom;
import cn.kgc.tangcco.pojo.Paginator;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 李昊哲
 * @Description
 * @create 2020/12/29 14:51
 */
@FeignClient("idiom-provider")
public interface IdiomService {

    @GetMapping(value = "/idiom/count")
    public long count();

    @GetMapping(value = "/idiom/findById/{id}")
    public Idiom findById(@PathVariable("id") Integer id);

    /**
     * 分页查询
     *
     * @param page 查询页码
     * @param size 每页记录数
     * @return
     */
    @GetMapping(value = "/idiom/findAllWithGetForm")
    public String findAllWithGetForm(@RequestParam Integer page, @RequestParam Integer size);

    /**
     * 分页查询
     *
     * @param page 查询页码
     * @param size 每页记录数
     * @return
     */
    @PostMapping(value = "/idiom/findAllWithPostForm")
    public String findAllWithPostForm(@RequestParam Integer page, @RequestParam Integer size);

    /**
     * 分页查询
     *
     * @return
     */
    @PostMapping(value = "/idiom/findAllWithPostJson")
    public String findAllWithPostJson(@RequestBody Paginator paginator);

    @PutMapping(value = "/idiom/save")
    public Idiom save(@RequestBody Idiom idiom);

    @DeleteMapping(value = "/idiom/deleteById/{id}")
    public Long deleteById(@PathVariable("id") Integer id);
}
